<?php 
if(!isset($_SESSION)) 
{ 
	session_start(); 
} 
include 'content-home/showscreen.php';
$filepath = "";
$filename = "";
if (isset($_SESSION['currentdownload']) and is_array($_SESSION['currentdownload'])) {
	$myarray = $_SESSION['currentdownload'];
	$url = new showscreen();
	if( $_SESSION['browser'] == "IE"){
		$url->GetPath($myarray[0],$myarray[1],$myarray[2],$myarray[3],$myarray[4],urlencode($myarray[5]),$myarray[6]);
	}else{
		$url->GetPath($myarray[0],$myarray[1],$myarray[2],$myarray[3],$myarray[4],$myarray[5],$myarray[6]);
	}
	$filepath =$url->image;     
	$poss = strrpos($filepath, '/');
	$filename = substr($filepath, $poss);  
}
	$url = $filepath;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
    curl_setopt($ch, CURLOPT_URL, $url);
    $result = curl_exec($ch);
    curl_close($ch);
header('content-type: image/jpeg');
header('Content-Type: application/download');
header('Content-Disposition: attachment; filename='.$filename); 
echo $result;?>
